<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:s="http://jboss.org/seam/faces"
	xmlns:p="http://primefaces.org/ui" template="/_template.xhtml">

	<ui:define name="corpo">
		<h:form>
			<p:tab>
				<h2>
					<h:outputText value="Novo Branch"
						rendered="#{empty branchBean.branch.id}" />
					<h:outputText value="Editar Branch"
						rendered="#{not empty branchBean.branch.id}" />
				</h2>

				<p:messages></p:messages>
				<fieldset>
					<legend>Dados do Branch</legend>
					<s:validateForm validatorId="validaBranch"></s:validateForm>


					<h:outputLabel value="Nome: " for="nome"></h:outputLabel>
					<h:inputText id="nome" value="#{branchBean.branch.nome}" required="true" requiredMessage="Preencher o nome">
					</h:inputText>


					<h:outputLabel value="URL: " for="nome"></h:outputLabel>
					<h:inputText id="url" value="#{branchBean.branch.url}"  required="true" requiredMessage="Preencher url"/>


						
				 <h:outputLabel value="Primeira Revisao: " for="nome"></h:outputLabel>
					<h:inputText id="revisao" value="#{branchBean.branch.revisao}" required="true" requiredMessage="Preencher o numero da revisao"/>
					
				 <h:commandButton value="grava" action="#{branchBean.grava}"
						style="display: inline; " />
				</fieldset>
			</p:tab>
		</h:form>
		<h:form>
			<h2>Lista de Branchs</h2>
			<h:dataTable value="#{branchBean.branchs}" var="branch"
				styleClass="dados" rowClasses="impar,par">

				<h:column>
					<f:facet name="header">Nome</f:facet>
			#{branch.nome}
		</h:column>

				<h:column>
					<f:facet name="header">Url SVN: </f:facet>
			#{branch.url}
			</h:column>
		   <h:column>
					<f:facet name="header">Primeira Revisao: </f:facet>
			#{branch.revisao}
			</h:column>
				<h:column>
					<f:facet name="header">Remover </f:facet>
					<h:commandLink action="#{branchBean.remove(branch)}"
						value="Remover">
						<f:ajax render="@form"></f:ajax>
					</h:commandLink>
				</h:column>
			</h:dataTable>
		</h:form>


	</ui:define>
</ui:composition>